import { createStore } from 'vuex'

export default createStore({
  state: {
    loginState:0,
    userId:'',
    token:''
  },
  mutations: {
    setLoginState(state,value){
      state.loginState=value;
    },
    setToken(state,value){
      state.token=value;
    },
    setUserId(state,value){
      state.userId=value;
    }
  },
  actions: {
    setLoginState(context,value){
      context.commit('setLoginState',value)
    },
    setToken(context,value){
      context.commit('setToken',value)
    },
    setUserId(context,value){
      context.commit('setUserId',value)
    }
  },
  getters:{
    getLoginState:(state)=>{
      return state.loginState;
    },
    getToken:(state)=>{
      return state.token;
    },
    getUserId:(state)=>{
      return state.userId;
    }
  },
  modules: {
  }
})
